package com.internship.javawebinternship.repository;

import ch.qos.logback.core.read.ListAppender;
import com.internship.javawebinternship.entity.OtherEmployeeInfo;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface OtherEmployeeInfoRepository extends JpaRepository<OtherEmployeeInfo, String> {

    @Transactional(rollbackFor = Exception.class)
    @Modifying
    @Query(value = "select * from covid19.other_employee_info where if(?1!='',department=?1,1=1) ", nativeQuery = true)
    public List<OtherEmployeeInfo> findEmployeeGroup(String department);
}
